﻿using System.ComponentModel;
using NuSoft.SistemaGestionPersonal.WinFormsUI.BusinessEntities;

namespace NuSoft.SistemaGestionPersonal.WinFormsUI
{
    static class EnumHelper
    {
        public static string ToLocalizedString(this MaritalStatus maritalStatus)
        {
            string result;

            switch (maritalStatus)
            {
                case MaritalStatus.Undefined:
                    result = string.Empty;
                    break;
                case MaritalStatus.Single:
                    result = "Soltero/a";
                    break;
                case MaritalStatus.Married:
                    result = "Casado/a";
                    break;
                case MaritalStatus.Divorced:
                    result = "Divorciado/a";
                    break;
                case MaritalStatus.Widowed:
                    result = "Viudo/a";
                    break;
                default:
                    throw new InvalidEnumArgumentException("maritalStatus", (int)maritalStatus, typeof(MaritalStatus));
            }

            return result;
        }

        public static MaritalStatus LocalizedStringToMaritalStatus(string localizedString)
        {
            MaritalStatus result;

            switch (localizedString)
            {
                case "Soltero/a":
                    result = MaritalStatus.Single;
                    break;
                case "Casado/a":
                    result = MaritalStatus.Married;
                    break;
                case "Divorciado/a":
                    result = MaritalStatus.Divorced;
                    break;
                case "Viudo/a":
                    result = MaritalStatus.Widowed;
                    break;
                default:
                    result = MaritalStatus.Undefined;
                    break;
            }

            return result;
        }

        public static string ToLocalizedString(this PositionCategory positionCategory)
        {
            string result;

            switch (positionCategory)
            {
                case PositionCategory.Undefined:
                    result = string.Empty;
                    break;
                case PositionCategory.Administrative:
                    result = "Administrativo";
                    break;
                case PositionCategory.Technical:
                    result = "Técnico";
                    break;
                case PositionCategory.WasteTreatment:
                    result = "Tratamiento de desechos";
                    break;
                default:
                    throw new InvalidEnumArgumentException("positionCategory", (int)positionCategory, typeof(PositionCategory));
            }

            return result;
        }

        public static PositionCategory LocalizedStringToPositionCategory(string localizedString)
        {
            PositionCategory result;

            switch (localizedString)
            {
                case "Administrativo":
                    result = PositionCategory.Administrative;
                    break;
                case "Técnico":
                    result = PositionCategory.Technical;
                    break;
                case "Tratamiento de desechos":
                    result = PositionCategory.WasteTreatment;
                    break;
                default:
                    result = PositionCategory.Undefined;
                    break;
            }

            return result;
        }
    }
}